//
//  UIColor+Extension.swift
//

import UIKit

extension UIColor {
    public static var theme: UIColor {
        return UIColor(rgb: 241, green: 155, blue: 65)
    }
    public static var yellowColor: UIColor {
        return UIColor(hex: "#FEE024")
    }
    
    public static var c666666: UIColor {
        return UIColor(hex: "#666666")
    }
    
    public static var c999999: UIColor {
        return UIColor(hex: "#999999")
    }
    
    public static var titleColor: UIColor {
        return UIColor(rgb: 75, green: 53, blue: 13)
    }
    
    public static var sysAlert: UIColor {
        return changeColor(UIColor(hex: "#242424"), light: UIColor.white)
    }
    
    public static var sysTheme: UIColor {
        return changeColor(UIColor(hex: "#191919"), light: UIColor(hex: "#1F83EC"))
    }
    
    public static var sysWhite: UIColor {
        return changeColor(UIColor.black, light: UIColor.white)
    }
    
    public static var sysBlack: UIColor {
        return changeColor(UIColor.white, light: UIColor.black)
    }
    
    /// app的背景底色
    public static var sysBackground: UIColor {
        return changeColor(UIColor.black, light: UIColor(hex: "#F6F6F6"))
    }
    public static var sysTableView: UIColor {
        return changeColor(UIColor(hex: "#191919"), light: UIColor.white)
    }
    /// 间隔线和表格线等
    public static var line: UIColor {
        return changeColor(UIColor(hex: "#1f1f1f"), light: UIColor(hex: "#dfe0e0"))
    }
    
    public static func changeColor(_ dark: UIColor, light: UIColor) -> UIColor {
        if #available(iOS 13.0, *) {
            return UIColor {
                $0.userInterfaceStyle == .dark ? dark : light
            }
        } else {
            return light
        }
    }
}
